import React, { useState } from 'react'

export default function App() {
    const [isShow,setIsShow]=useState<boolean>(true)
    return (
        <div>
            <Father isShow={isShow} changeShow={()=>{
                setIsShow(!isShow)
            }}/>
            {isShow && <Child/> }
        </div>
        
    )
}

interface IFather{
    changeShow:()=>void,
    isShow:boolean
}
function Father(props:IFather){
    return <div>
        Father <button onClick={()=>{
            props.changeShow()
        }}>{props.isShow?'上班':'带孩子'}</button>
    </div>
}

function Child(){
    return <div>
        孩子
    </div>
}